package priv.lirenhe.dissertation.component.crawler_robot.url_manager.url_ini;

import java.io.File;

import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration;

public class PropConfig {
	
	public static PropertiesConfiguration getPropConfig(String propName){
		PropertiesConfiguration propConfig = null;
		try {
			propConfig = new PropertiesConfiguration();
			propConfig.setEncoding("UTF-8");
			propConfig.load(propName);
			propConfig.setAutoSave(true);
		} catch (ConfigurationException e) {
			e.printStackTrace();
		}
		return propConfig;
	}
	
	public static PropertiesConfiguration getPropConfig(File file){
		PropertiesConfiguration propConfig = null;
		try {
			propConfig = new PropertiesConfiguration();
			propConfig.setEncoding("UTF-8");
			propConfig.load(file);
			propConfig.setAutoSave(true);
		} catch (ConfigurationException e) {
			e.printStackTrace();
		}
		return propConfig;
	}
}
